﻿using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace EasyBackup.Utils
{
    static class App
    {
        public static string Location = Path.GetDirectoryName(Application.ExecutablePath);
        public static string LogDir = Location + @"\Logs";
        public static string SchedulePath = Location + @"\schedule.txt";

        public static bool IsAppInstanceExist()
        {
            bool isExist = false;

            Process curProc = Process.GetCurrentProcess();            
            Process[] pp = Process.GetProcessesByName(curProc.ProcessName);

            if (pp.Length > 1)
            {
                isExist = true;
            }

            curProc.Dispose();
            foreach (Process p in pp)
            {
                p.Dispose();
            }

            return isExist;            
        }
    }
}
